package com.hksj.em.controller;

import com.hksj.common.core.model.Rest;
import com.hksj.em.dto.create.CreateCaregiverTaskDTO;
import com.hksj.em.dto.update.BatchUpdateCaregiverTaskDTO;
import com.hksj.em.query.CaregiverTaskQuery;
import com.hksj.em.service.CaregiverService;
import com.hksj.em.vo.CaregiverTaskVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zengke
 * @version 1.0
 * @see CaregiverTaskController
 * @since 2025/04/23 9:15
 */

@Api(tags = "智慧手术室-护工任务")
@RequestMapping(value = "/api/caregiverTask")
@RestController
public class CaregiverTaskController {

    @Resource
    private CaregiverService caregiverService;

    @ApiOperation(value = "动态查询护工任务列表")
    @PostMapping("/queryCaregiverTaskList")
    public Rest<List<CaregiverTaskVO>> queryCaregiverTaskList(@RequestBody CaregiverTaskQuery query){
        List<CaregiverTaskVO> caregiverTaskList = caregiverService.queryCaregiverTaskList(query);
        return Rest.ok(caregiverTaskList);
    }

    @ApiOperation(value = "批量更新护工任务列表")
    @PostMapping("/batchUpdateCaregiverTask")
    public Rest<String> batchUpdateCaregiverTask(@RequestBody BatchUpdateCaregiverTaskDTO dto){
        String result = caregiverService.batchUpdateCaregiverTask(dto);
        return Rest.ok(result);
    }

    @ApiOperation(value = "创建护工任务")
    @PostMapping(value = "/createCaregiverTask")
    public Rest<String> createCaregiverTask(@RequestBody CreateCaregiverTaskDTO dto){
        String result = caregiverService.createCaregiverTask(dto);
        return Rest.ok(result);
    }

}
